﻿using System;
using System.Windows.Forms;

namespace TextEditor
{
    

    public class A_DivProperty : A_Action
    {
        public override string ActionName()
        {
            return "divproperty";
        }

        public override bool Execute()
        {
            ZYTextDiv parent = base.myOwnerDocument.Content.CurrentElement.Parent as ZYTextDiv;
            if (parent != null)
            {
                using (dlgDivProperty property = new dlgDivProperty())
                {
                    property.DivObject = parent;
                    if (property.ShowDialog() == DialogResult.OK)
                    {
                        base.myOwnerDocument.RefreshLine();
                        base.myOwnerDocument.UpdateView();
                    }
                }
            }
            return true;
        }

        public override bool isEnable()
        {
            return (((base.myOwnerDocument.CanModify() && (base.myOwnerDocument.Content.CurrentElement != null)) && (base.myOwnerDocument.Content.CurrentElement.Parent is ZYTextDiv)) && base.isEnable());
        }
    }
}

